package com.pearadmin.pro.modules.paper.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.pearadmin.pro.common.aop.annotation.Log;
import com.pearadmin.pro.common.constant.ControllerConstant;
import com.pearadmin.pro.common.web.base.BaseController;
import com.pearadmin.pro.common.web.domain.Result;
import com.pearadmin.pro.modules.examUtils.PagingReqDTO;
import com.pearadmin.pro.modules.paper.dto.request.UserExamReqDTO;
import com.pearadmin.pro.modules.paper.dto.response.UserExamRespDTO;
import com.pearadmin.pro.modules.paper.service.UserExamService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@Api(tags = {"考试记录"})
@RestController
@RequestMapping(ControllerConstant.PREFIX_SYS + "userExam")
public class UserExamController extends BaseController {

    @Resource
    private UserExamService baseService;


    /**
     * 分页查找
     * @param reqDTO
     * @return
     */
    @ApiOperation(value = "我得成绩分页")
    @Log(title = "我得成绩分页")
    @RequestMapping(value = "/my-paging", method = { RequestMethod.GET})
    public Result<IPage<UserExamRespDTO>> MyPaging(PagingReqDTO<UserExamReqDTO> reqDTO) {
        //分页查询并转换
        IPage<UserExamRespDTO> page = baseService.myPaging(reqDTO);
        return success(page);
    }
    /**
     * 分页查找
     * @param reqDTO
     * @return
     */
    @ApiOperation(value = "试卷成绩分页")
    @Log(title = "试卷成绩分页")
    @RequestMapping(value = "/paging", method = { RequestMethod.POST})
    public Result<IPage<UserExamRespDTO>> paging(@RequestBody PagingReqDTO<UserExamReqDTO> reqDTO) {

        //分页查询并转换
        IPage<UserExamRespDTO> page = baseService.paging(reqDTO);

        return success(page);
    }

}
